<?php

namespace App\Store\Validate\Financial\Statements;

use App\Common\Validate\BaseValidate;

/**
 * 验证器
 */
class Profit extends BaseValidate
{
    //验证规则
    protected $rule = [];
    //自定义验证信息
    protected $message = [];

    public function __construct($doaction = 'add')
    {
        $this->rule = [
            'year'=>'required',
            'month'=>'required',
        ];
        $this->message = [
            'year.required' => '参数错误',
            'month.integer' => '参数错误',   
        ];

        for($i=1;$i<=32;$i++){
            $this->rule[]=['data_key_'.$i=>'required|integer|gte:0'];
            $this->message[]=['data_key_'.$i.'.required'=>'请保持表单完成'];
            $this->message[]=['data_key_'.$i.'.integer'=>'金额不能小于0'];
            $this->message[]=['data_key_'.$i.'.gte'=>'金额不能小于0'];
        }
    }
}
